<!DOCTYPE html>
<html lang="zh-CN">





<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/favicon.png">
  <link rel="icon" type="image/png" href="/img/favicon.png">
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="description" content="机器学习，深度学习，强化学习，算法，Linux">
  <meta name="author" content="seven">
  <meta name="keywords" content="">
  <title>机器学习-贝叶斯网络 - SimpleAI</title>

  <link  rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/css/bootstrap.min.css" />
<link  rel="stylesheet" href="https://cdn.staticfile.org/github-markdown-css/4.0.0/github-markdown.min.css" />


  <link  rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/10.0.0/styles/github-gist.min.css" />


<!-- 主题依赖的图标库，不要自行修改 -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_fmb4a04yx8h.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_pjno9b9zyxs.css">




<link  rel="stylesheet" href="/css/main.css" />

<!-- 自定义样式保持在最底部 -->


<meta name="generator" content="Hexo 4.2.1"></head>


<body>
  <header style="height: 70vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand"
       href="/">&nbsp;<strong>Simple AI</strong>&nbsp;</a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          <li class="nav-item">
            <a class="nav-link" href="/">
              <i class="iconfont icon-home-fill"></i>
              首页</a>
          </li>
        
          
          
          
          <li class="nav-item">
            <a class="nav-link" href="/archives/">
              <i class="iconfont icon-archive-fill"></i>
              归档</a>
          </li>
        
          
          
          
          <li class="nav-item">
            <a class="nav-link" href="/categories/">
              <i class="iconfont icon-category-fill"></i>
              分类</a>
          </li>
        
          
          
          
          <li class="nav-item">
            <a class="nav-link" href="/tags/">
              <i class="iconfont icon-tags-fill"></i>
              标签</a>
          </li>
        
          
          
          
          <li class="nav-item">
            <a class="nav-link" href="/about/">
              <i class="iconfont icon-user-fill"></i>
              关于</a>
          </li>
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" data-toggle="modal" data-target="#modalSearch">&nbsp;&nbsp;<i
                class="iconfont icon-search"></i>&nbsp;&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="view intro-2" id="background" parallax=true
         style="background: url('/img/default.png') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
          <div class="container text-center white-text fadeInUp">
            <span class="h2" id="subtitle">
              
            </span>

            
              
                <div class="mt-3 post-meta">
                  <i class="iconfont icon-date-fill" aria-hidden="true"></i>
                  <time datetime="2018-07-31 10:00">
                    2018年7月31日 上午
                  </time>
                </div>
              

              <div class="mt-1">
                
                  
                  <span class="post-meta mr-2">
                    <i class="iconfont icon-chart"></i>
                    1.3k 字
                  </span>
                

                
                  
                  <span class="post-meta mr-2">
                      <i class="iconfont icon-clock-fill"></i>
                    
                    
                    17
                     分钟
                  </span>
                

                
                  <!-- 不蒜子统计文章PV -->
                  
                  <span id="busuanzi_container_page_pv" class="post-meta" style="display: none">
                    <i class="iconfont icon-eye" aria-hidden="true"></i>
                    <span id="busuanzi_value_page_pv"></span> 次
                  </span>
                
              </div>
            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid">
  <div class="row">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-md">
      <div class="container nopadding-md" id="board-ctn">
        <div class="py-5" id="board">
          <div class="post-content mx-auto" id="post">
            
              <p class="note note-info">
                
                  本文最后更新于：2 小时前
                
              </p>
            
            <article class="markdown-body">
              <h3 id="贝叶斯网络的概念"><a href="#贝叶斯网络的概念" class="headerlink" title="贝叶斯网络的概念"></a>贝叶斯网络的概念</h3><p>把某个研究系统中涉及的<strong>随机变量</strong>，根据是否条件独立绘制在一个<strong>有向图</strong>中，就形成了<strong><code>贝叶斯网络</code></strong>。</p>
<p>贝叶斯网络(Bayesian network)，又称信念网络(Belief Network)，或<strong>有向无环图模型</strong>。是一种概率图模型，根据概率图的拓扑结构，考察一组随机变量${ X_1,X_2…X_n}$及其n组<strong>条件概率分布</strong>的性质。也就是说它用网络结构代表领域的基本因果知识。  </p>
<h3 id="贝叶斯网络的形式化定义"><a href="#贝叶斯网络的形式化定义" class="headerlink" title="贝叶斯网络的形式化定义"></a>贝叶斯网络的形式化定义</h3><ul>
<li><p>$BN(G,Θ)$: 贝叶斯网络(Bayesian Network)</p>
<ul>
<li><p>$G$:有向无环图 (Directed Acyclic Graphical model, DAG)</p>
</li>
<li><p>$G$的结点:随机变量$X_1,X_2…X_n$</p>
</li>
<li><p>$G$的边:结点间的有向依赖</p>
</li>
<li><p>$Θ$:所有条件概率分布的参数集合</p>
</li>
<li><p>结点X的条件概率: $P(X |parent(X))$</p>
<p>$P(S,C,B,X,D)=P(S)P(C \mid S)P(B \mid S)P(X \mid C,S)P(D \mid C,B)$</p>
</li>
</ul>
</li>
</ul>
<p>每个结点所需参数的个数:</p>
<p>若结点的$parent$数目是$M$,结点和$parent$的可取值数目都是$K:K^M∗(K−1)$</p>
<h3 id="一个简单的贝叶斯网络"><a href="#一个简单的贝叶斯网络" class="headerlink" title="一个简单的贝叶斯网络"></a>一个简单的贝叶斯网络</h3><p><img src="https://eveseven.oss-cn-shanghai.aliyuncs.com/20200530230251.png" srcset="/img/loading.gif" alt="image"></p>
<h4 id="P-a-b-c-P-c-mid-a-b-P-a-b-P-c-mid-a-b-P-b-mid-a-P-a"><a href="#P-a-b-c-P-c-mid-a-b-P-a-b-P-c-mid-a-b-P-b-mid-a-P-a" class="headerlink" title="$P(a,b,c)=P(c \mid a,b)P(a,b)=P(c \mid a,b)P(b \mid a)P(a)$"></a>$P(a,b,c)=P(c \mid a,b)P(a,b)=P(c \mid a,b)P(b \mid a)P(a)$</h4><h3 id="全连接贝叶斯网络"><a href="#全连接贝叶斯网络" class="headerlink" title="全连接贝叶斯网络"></a>全连接贝叶斯网络</h3><p><strong>每一对结点之间都有边连接</strong></p>
<h4 id="p-x-1-…x-n-p-x-K-mid-x-1-…-x-K-1-…p-x-2-mid-x-1-p-x-1"><a href="#p-x-1-…x-n-p-x-K-mid-x-1-…-x-K-1-…p-x-2-mid-x-1-p-x-1" class="headerlink" title="$p(x_1,…x_n)=p(x_K \mid x_1,…,x_{K-1})…p(x_2 \mid x_1)p(x_1)$"></a>$p(x_1,…x_n)=p(x_K \mid x_1,…,x_{K-1})…p(x_2 \mid x_1)p(x_1)$</h4><h4 id="P-X-1-x-1-…-X-n-x-n-prod-i-1-nP-X-i-x-i-mid-X-i-1-…-X-n-x-n"><a href="#P-X-1-x-1-…-X-n-x-n-prod-i-1-nP-X-i-x-i-mid-X-i-1-…-X-n-x-n" class="headerlink" title="$P(X_1=x_1,…,X_n=x_n)=\prod_{i=1}^nP(X_i=x_i \mid X_{i+1},…,X_n=x_n)$"></a>$P(X_1=x_1,…,X_n=x_n)=\prod_{i=1}^nP(X_i=x_i \mid X_{i+1},…,X_n=x_n)$</h4><h3 id="一个”正常“的贝叶斯网络"><a href="#一个”正常“的贝叶斯网络" class="headerlink" title="一个”正常“的贝叶斯网络"></a>一个”正常“的贝叶斯网络</h3><p><img src="https://eveseven.oss-cn-shanghai.aliyuncs.com/20200530230252.png" srcset="/img/loading.gif" alt="image"></p>
<p>从图中我们可以看出：</p>
<ul>
<li><p>有些边是缺失的</p>
</li>
<li><p>直观上来看：$x_1,x_2$是相互独立的</p>
</li>
<li><p>直观上来看：$x_6,x_7$在$x_4$给定的条件下独立</p>
</li>
<li><p>$x_1,x_2,…x_7$的联合分布：</p>
<h4 id="P-x-1-P-x-2-P-x-3-P-x-4-mid-x-1-x-2-x-3-P-x-5-mid-x-1-x-3-P-x-6-mid-x-4-P-x-7-mid-x-4-x-5"><a href="#P-x-1-P-x-2-P-x-3-P-x-4-mid-x-1-x-2-x-3-P-x-5-mid-x-1-x-3-P-x-6-mid-x-4-P-x-7-mid-x-4-x-5" class="headerlink" title="$P(x_1)P(x_2)P(x_3)P(x_4\mid x_1, x_2, x_3)P(x_5\mid x_1, x_3)P(x_6\mid x_4)P(x_7\mid x_4, x_5)$"></a>$P(x_1)P(x_2)P(x_3)P(x_4\mid x_1, x_2, x_3)P(x_5\mid x_1, x_3)P(x_6\mid x_4)P(x_7\mid x_4, x_5)$</h4></li>
</ul>
<h3 id="贝叶斯网络的条件独立判定"><a href="#贝叶斯网络的条件独立判定" class="headerlink" title="贝叶斯网络的条件独立判定"></a>贝叶斯网络的条件独立判定</h3><p>我们来看一下贝叶斯网络的条件是如何判定的：</p>
<ol>
<li><h4 id="条件独立：tail-to-tail"><a href="#条件独立：tail-to-tail" class="headerlink" title="条件独立：tail-to-tail"></a>条件独立：<strong>tail-to-tail</strong></h4><p><img src="https://eveseven.oss-cn-shanghai.aliyuncs.com/20200530230253.png" srcset="/img/loading.gif" alt="image"></p>
<p>根据图模型，得：$P(a,b,c)=P(c)P(a \mid c)P(b \mid c)$</p>
<p>从而：$P(a,b,c)/P(c)=P(a \mid c)P(b \mid c)$</p>
<p>因为$P(a,b \mid c)=P(a,b,c)/P(c)$</p>
<p>得：$P(a,b\mid c)=P(a\mid c)P(b\mid c)$</p>
<p>解释：在<code>c</code>给定的条件下，因为<code>a,b</code>被阻断（blocked），因此是独立的：$P(a,b\mid c)=P(a\mid c)P(b\mid c)$</p>
</li>
</ol>
<ol start="2">
<li><h4 id="条件独立：head-to-tail"><a href="#条件独立：head-to-tail" class="headerlink" title="条件独立：head-to-tail"></a>条件独立：head-to-tail</h4><p><img src="https://eveseven.oss-cn-shanghai.aliyuncs.com/20200530230254.png" srcset="/img/loading.gif" alt="image"></p>
<p>根据图模型，得：$P(a,b,c)=P(a)P(c \mid a)P(b \mid c)$</p>
<p>$P(a,b \mid c) \\ =P(a,b,c)/P(c) \\ =P(a)P(c \mid a)P(b \mid c) / P(c) \\ =P(a,c)P(b \mid c) / P(c) \\ = P(a\mid c)P(b\mid c)$</p>
<p>解释：在<code>c</code>给定的条件下，因为<code>a,b</code>被阻断（blocked），因此是独立的：$P(a,b\mid c)=P(a\mid c)P(b\mid c)$</p>
</li>
</ol>
<ol start="3">
<li><h4 id="条件独立：head-to-head"><a href="#条件独立：head-to-head" class="headerlink" title="条件独立：head-to-head"></a>条件独立：head-to-head</h4><p><img src="https://eveseven.oss-cn-shanghai.aliyuncs.com/20200530230255.png" srcset="/img/loading.gif" alt="image"></p>
<p>根据图模型，得：$P(a,b,c)=P(a)P(b)P(c \mid a,b) $</p>
<p>由：$\sum_c P(a,b,c)= \sum_n P(a)P(b)P(c \mid a,b)$</p>
<p>得：$P(a,b)=P(a)P(b)$</p>
<p>解释：在<code>c</code>给定的条件下，因为<code>a,b</code>被阻断（blocked），因此是独立的：$P(a,b)=P(a)P(b)$</p>
</li>
</ol>
<h3 id="有向分离"><a href="#有向分离" class="headerlink" title="有向分离"></a>有向分离</h3><p>对于任意的结点集,<code>有向分离</code>(D-separation): 对于任意的结点集<code>A,B,C</code>,考察所有通过A中任意结点到B中任意结点的路径,若要求<code>A,B</code>条件独立,则需要所有的路径都被阻断(blocked),即满足下列两个前提之一:  </p>
<ol>
<li>A和B的<code>head-to-tail型</code>和<code>tail-to-tail型</code>路径都通过C; </li>
<li>A和B的<code>head-to-head型</code>路径不通过C以及C的子孙结点; </li>
</ol>
<p><img src="https://eveseven.oss-cn-shanghai.aliyuncs.com/20200530230256.png" srcset="/img/loading.gif" alt="image"></p>
<p>图(a), 在<code>tail-to-tail</code>中, <code>f</code>没有阻断; 在<code>head-to-head</code>中, <code>e</code>阻断, 然而它的子结点<code>c</code>没有阻断, 即<code>e</code>所在的结点集没有阻断; 因此, 结点<code>a, b</code>关于<code>c</code>不独立.</p>
<p> 图(b), 在<code>tail-to-tail</code>中, <code>f</code>阻断; 因此, 结点<code>a,b</code>关于<code>f</code> 独立. 在<code>head-to-head</code>中, <code>e</code>和它的子孙结点<code>c</code>都阻断; 因此, 结点<code>a,b</code>关于<code>e</code>独立.</p>
<h3 id="特殊的贝叶斯网络"><a href="#特殊的贝叶斯网络" class="headerlink" title="特殊的贝叶斯网络"></a>特殊的贝叶斯网络</h3><ol>
<li><h4 id="马尔科夫模型"><a href="#马尔科夫模型" class="headerlink" title="马尔科夫模型"></a>马尔科夫模型</h4><p><img src="https://eveseven.oss-cn-shanghai.aliyuncs.com/20200530230257.png" srcset="/img/loading.gif" alt="image"></p>
<p>结点形成一条链式网络，这种按顺次演变的随机过程模型就称作<strong>马尔科夫模型</strong></p>
<p>$A_{i+1}$只与$A_i$有关，与$A_1,…,A_{i-1}$无关。</p>
</li>
<li><h4 id="隐马尔科夫模型"><a href="#隐马尔科夫模型" class="headerlink" title="隐马尔科夫模型"></a><strong>隐马尔科夫模型</strong></h4><h4 id="Hidden-Markov-Model"><a href="#Hidden-Markov-Model" class="headerlink" title="Hidden Markov Model"></a><code>Hidden Markov Model</code></h4><p><img src="https://eveseven.oss-cn-shanghai.aliyuncs.com/20200530230258.png" srcset="/img/loading.gif" alt="image"></p>
<ul>
<li>隐马尔科夫模型（HMM）可用标注问题，在语音识别、NLP、生物信息、模式识别等领域别实践证明的有效算法。</li>
<li>HMM是关于时序的概率模型，描述由一个隐藏的马尔可夫链随机生成不可观测的状态随机序列，再由各个状态生成一个观测而产生观测随机序列的过程。</li>
<li>HMM随机生成的状态的序列，成为<code>状态序列</code>，每个状态生成一个观测，由此产生的观测随机序列，称为<code>观测序列</code><ul>
<li>序列的每一个位置可看做是一个时刻。</li>
<li>空间序列也可以使用该模型.</li>
</ul>
</li>
</ul>
</li>
</ol>
<ol start="3">
<li><h4 id="马尔科夫毯"><a href="#马尔科夫毯" class="headerlink" title="马尔科夫毯"></a><strong>马尔科夫毯</strong></h4><p>一个结点的*<em><code>Markov Blanket</code> *</em>是一个集合，在这个集合中的结点都给定条件下，该结点条件独立于其他结点。</p>
<p>*<em><code>Markov Blanket</code> *</em>: 一个结点的<code>Markov Blanket</code>是它的<code>parents,children</code>以及<code>spouses</code></p>
<p><img src="https://eveseven.oss-cn-shanghai.aliyuncs.com/20200530230259.png" srcset="/img/loading.gif" alt="image"></p>
</li>
</ol>
<div class="hljs"><pre><code>深色的结点集合，就是“马尔科夫毯”（**`Markov Blanket` **）</code></pre></div>
            </article>
            <hr>
            <div>
              <div class="post-metas mb-3">
                
                  <div class="post-meta mr-3">
                    <i class="iconfont icon-category"></i>
                    
                      <a class="hover-with-bg" href="/categories/%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0/">机器学习</a>
                    
                  </div>
                
                
                  <div class="post-meta">
                    <i class="iconfont icon-tags"></i>
                    
                      <a class="hover-with-bg" href="/tags/%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0/">机器学习</a>
                    
                      <a class="hover-with-bg" href="/tags/%E8%B4%9D%E5%8F%B6%E6%96%AF%E7%BD%91%E7%BB%9C/">贝叶斯网络</a>
                    
                      <a class="hover-with-bg" href="/tags/%E4%BF%A1%E5%BF%B5%E7%BD%91%E7%BB%9C%EF%BC%8C%E6%9C%89%E5%90%91%E6%97%A0%E7%8E%AF%E6%A8%A1%E5%9E%8B/">信念网络，有向无环模型</a>
                    
                  </div>
                
              </div>
              
                <p class="note note-warning">本博客所有文章除特别声明外，均采用 <a href="https://zh.wikipedia.org/wiki/Wikipedia:CC_BY-SA_3.0%E5%8D%8F%E8%AE%AE%E6%96%87%E6%9C%AC" target="_blank" rel="nofollow noopener noopener">CC BY-SA 3.0协议</a> 。转载请注明出处！</p>
              
              
                <div class="post-prevnext row">
                  <div class="post-prev col-6">
                    
                    
                  </div>
                  <div class="post-next col-6">
                    
                    
                      <a href="/2018/07/30/2018-08-01-ml-NB/">
                        <span class="hidden-mobile">机器学习-朴素贝叶斯</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </div>
                </div>
              
            </div>

            
              <!-- Comments -->
              <div class="comments" id="comments">
                
                
  <script defer src="https://utteranc.es/client.js"
          repo="sevenold/blog_comments"
          issue-term="pathname"
  
          label="utterances"
    
          theme="github-dark"
          crossorigin="anonymous"
  >
  </script>


              </div>
            
          </div>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div id="tocbot"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    
  </main>

  
    <a id="scroll-top-button" href="#" role="button">
      <i class="iconfont icon-arrowup" aria-hidden="true"></i>
    </a>
  

  
    <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
  

  

  

  <footer class="mt-5">
  <div class="text-center py-3">
    <div>
      <a href="https://ai-club.gitee.io" target="_blank" rel="nofollow noopener"><span>Seven</span></a>
      <i class="iconfont icon-love"></i>
      <a href="https://ai-club.gitee.io" target="_blank" rel="nofollow noopener"><span>算法</span></a>
    </div>
    
  <div>
    
      <!-- 不蒜子统计PV -->
      
      <span id="busuanzi_container_site_pv" style="display: none">
      总访问量 <span id="busuanzi_value_site_pv"></span> 次
    </span>
    
    
      <!-- 不蒜子统计UV -->
      
      <span id="busuanzi_container_site_uv" style="display: none">
      总访客数 <span id="busuanzi_value_site_uv"></span> 人
    </span>
    
  </div>


    

    
  </div>
</footer>

<!-- SCRIPTS -->
<script  src="https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js" ></script>
<script  src="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/js/bootstrap.min.js" ></script>
<script  src="/js/main.js" ></script>


  <script  src="/js/lazyload.js" ></script>



  
  <script  src="https://cdn.staticfile.org/tocbot/4.11.1/tocbot.min.js" ></script>
  <script>
    $(document).ready(function () {
      var boardCtn = $('#board-ctn');
      var boardTop = boardCtn.offset().top;

      tocbot.init({
        tocSelector: '#tocbot',
        contentSelector: '.post-content',
        headingSelector: 'h1,h2,h3,h4,h5,h6',
        linkClass: 'tocbot-link',
        activeLinkClass: 'tocbot-active-link',
        listClass: 'tocbot-list',
        isCollapsedClass: 'tocbot-is-collapsed',
        collapsibleClass: 'tocbot-is-collapsible',
        collapseDepth: 0,
        scrollSmooth: true,
        headingsOffset: -boardTop
      });
      if ($('.toc-list-item').length > 0) {
        $('#toc').css('visibility', 'visible');
      }
    });
  </script>





  <script defer src="https://cdn.staticfile.org/clipboard.js/2.0.6/clipboard.min.js" ></script>
  <script  src="/js/clipboard-use.js" ></script>



  <script defer src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" ></script>




<!-- Plugins -->


  
    <!-- Baidu Analytics -->
    <script defer>
      var _hmt = _hmt || [];
      (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?148e1083cf73cfd11f7ffaae0cd55877";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>
  

  

  

  

  

  



  <script  src="https://cdn.staticfile.org/typed.js/2.0.11/typed.min.js" ></script>
  <script>
    var typed = new Typed('#subtitle', {
      strings: [
        '  ',
        "机器学习-贝叶斯网络&nbsp;",
      ],
      cursorChar: "_",
      typeSpeed: 70,
      loop: false,
    });
    typed.stop();
    $(document).ready(function () {
      $(".typed-cursor").addClass("h2");
      typed.start();
    });
  </script>



  <script  src="https://cdn.staticfile.org/anchor-js/4.2.2/anchor.min.js" ></script>
  <script>
    anchors.options = {
      placement: "right",
      visible: "hover",
      
    };
    var el = "h1,h2,h3,h4,h5,h6".split(",");
    var res = [];
    for (item of el) {
      res.push(".markdown-body > " + item)
    }
    anchors.add(res.join(", "))
  </script>



  <script  src="/js/local-search.js" ></script>
  <script>
    var path = "/local-search.xml";
    var inputArea = document.querySelector("#local-search-input");
    inputArea.onclick = function () {
      searchFunc(path, 'local-search-input', 'local-search-result');
      this.onclick = null
    }
  </script>



  <script  src="https://cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.js" ></script>
  <link  rel="stylesheet" href="https://cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.css" />

  <script>
    $('#post img:not(.no-zoom img, img[no-zoom]), img[zoom]').each(
      function () {
        var element = document.createElement('a');
        $(element).attr('data-fancybox', 'images');
        $(element).attr('href', $(this).attr('src'));
        $(this).wrap(element);
      }
    );
  </script>





  

  
    <!-- MathJax -->
    <script>
      MathJax = {
        tex: {
          inlineMath: [['$', '$'], ['\\(', '\\)']]
        },
        options: {
          renderActions: {
            findScript: [10, doc => {
              document.querySelectorAll('script[type^="math/tex"]').forEach(node => {
                const display = !!node.type.match(/; *mode=display/);
                const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
                const text = document.createTextNode('');
                node.parentNode.replaceChild(text, node);
                math.start = { node: text, delim: '', n: 0 };
                math.end = { node: text, delim: '', n: 0 };
                doc.math.push(math);
              });
            }, '', false],
            insertedScript: [200, () => {
              document.querySelectorAll('mjx-container').forEach(node => {
                let target = node.parentNode;
                if (target.nodeName.toLowerCase() === 'li') {
                  target.parentNode.classList.add('has-jax');
                }
              });
            }, '', false]
          }
        }
      };
    </script>

    <script async src="https://cdn.staticfile.org/mathjax/3.0.5/es5/tex-svg.js" ></script>

  














</body>
</html>
